#include<stdio.h>

// lapacke headers
#include "lapacke.h"
#include "lapacke_config.h"
#include "lapacke_utils.h"

extern lapack_int LAPACKE_dgeev( int matrix_order, char jobvl, char jobvr,
lapack_int n, double * a, lapack_int lda, double * wr,
double * wi, double * vl, lapack_int ldvl, double * vr,
lapack_int ldvr );

int main(){
int matrix_order = LAPACK_COL_MAJOR;
char jobvl = ' N ' ;
char jobvr = ' V ' ;
int n =50;
 double A[2500] ;
 for(int ii=0;ii<50;ii++)
   for(int jj=0;jj<50;jj++)
     {
       if(ii-jj==1||jj-ii==1)
     A[ii*50+jj]=1;
       else if(ii==jj)
     A[ii*50+jj]=3;
       else
     ;
     }
int lda = n;
 double wr[50] = {0};
 double wi[50] = {0};
double vl[2500];
int ldvl =50;
double vr[2500];
int ldvr =50;

int info = LAPACKE_dgeev(matrix_order,jobvl,jobvr,n,A,lda,wr,wi,vl,ldvl,vr,ldvr);
if (info == 0 ){
int i = 0 ;
int j = 0 ;
for (i = 0 ;i < n;i ++ ){
printf( " eigenvalue %d:\n " ,i);
printf( " %.6g + i %.6g \t " ,wr[i],wi[i]);
printf( " right eigenvector: " );
for (j = 0 ;j < ldvr;j ++ )
printf( " %.6g \t " ,vr[i * 4 + j]);
printf( " \n " );
}
printf( " SUCCESS\n " );
}

return 0 ;
} 